#ifndef LIBVZCONN_CONN_TCPSERVER_H_
#define LIBVZCONN_CONN_TCPSERVER_H_

#include "vzconn/base/basicdefines.h"
#include "vzconn/conn/tcpconnect.h"
#include "vzconn/conn/vzserver.h"

namespace vzconn {


class TcpServer : public VzServer {
 public:
  explicit TcpServer(boost::asio::io_service &io_service,
                     const std::string addr,
                     uint16 port);
  virtual ~TcpServer();

  virtual bool Start();

  virtual const std::string bind_addr() const ;
 protected:

  virtual void WaitNextConnect();
  virtual void HandleStopVzServer();
 private:
  boost::asio::ip::tcp::endpoint bind_addr_;
  std::string addr_str_;
  boost::scoped_ptr<boost::asio::ip::tcp::acceptor> acceptor_;
  bool stop_;
};


}

#endif // LIBVZCONN_CONN_TCPSERVER_H_